<?php
$params = array_merge(
    require(__DIR__ . '/../../common/config/params.php'),
    require(__DIR__ . '/../../common/config/params-local.php'),
    require(__DIR__ . '/params.php'),
    require(__DIR__ . '/params-local.php')
);

return [
    'id' => 'app-backend',
    'basePath' => dirname(__DIR__),
    'controllerNamespace' => 'backend\controllers',
    'bootstrap' => ['log'],
    'timeZone' => 'Asia/Shanghai',
    'modules' => [
        'admin' => [
            'class' => 'mdm\admin\Module',
            'layout' => 'left-menu',//yii2-admin�ĵ����˵�
        ],
        'gridview' =>  [
            'class' => '\kartik\grid\Module'
        ],
        'markdown' => [
            'class' => 'kartik\markdown\Module',
        ]
    ],
//    'as access' => [
//        'class' => 'mdm\admin\components\AccessControl',
//        'allowActions' => [
//            'site/*',//������ʵĽڵ㣬���������
//            'admin/*',//���������˷���admin�ڵ㼰���ӽڵ�
////            'gii/*',//���������˷���admin�ڵ㼰���ӽڵ�
//        ]
//    ],
    'components' => [
        'request' => [
            'csrfParam' => '_csrf',
        ],
        'authManager' => [
            'class' => 'yii\rbac\DbManager', // ʹ�����ݿ���������ļ�
            'itemTable'=>'auth_item',
            'itemChildTable'=>'auth_item_child',
            'assignmentTable'=>'auth_assignment',
        ],
        'user' => [
            'identityClass' => 'backend\models\Admin',
            'enableAutoLogin' => true,
            'identityCookie' => ['name' => '_identity-backend', 'httpOnly' => true],
        ],
        'session' => [
            // this is the name of the session cookie used for login on the backend
            'name' => 'advanced-backend',
        ],
        'log' => [
            'traceLevel' => YII_DEBUG ? 3 : 0,
            'targets' => [
                [
                    'class' => 'yii\log\FileTarget',
                    'levels' => ['error', 'warning'],
                ],
            ],
        ],
//        'urlManager' => [
//            'enablePrettyUrl' => true,
//            'showScriptName' => false,
//        ],
        'i18n' => [
            'translations' => [
                '*' => [
                    'class' => 'yii\i18n\PhpMessageSource',
                    'sourceLanguage' => 'zh-CN',
                ],
                'log' => [
                    'class' => 'yii\i18n\PhpMessageSource',
                    'basePath' => '@backend/modules/log/messages',
                    'sourceLanguage' => 'zh-CN',
                    'fileMap' => [
                        'log' => 'kavdata.php',
                    ],
                ],
                'wxUser' => [
                    'class' => 'yii\i18n\PhpMessageSource',
                    'sourceLanguage' => 'zh-CN',
                    'basePath' => 'messages/wxUser',
                ],
            ],
        ],

    ],
    'params' => $params,
];
